<?php

namespace App\Kuafu\Mybank\Model;

use App\Kuafu\Base\Model\BaseModel;
use App\Kuafu\Base\Model\Traits\KfSoftDeletes;
use App\Kuafu\Base\Model\Traits\KfUid;
use App\Kuafu\Shop\Model\Shop;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasOne;

class MybankOrderRecordWithholdMappingsModel extends BaseModel
{
    use HasFactory, KfSoftDeletes;

    protected $connection = 'mysql';
    protected $table      = "mybank_order_record_withhold_mappings";

    protected $fillable = [
        'id',
        'orderRecordId',
        'orderWithholdRecordId',
        'amount',
        'createdAt',
        'updatedAt',
        'isDeleted'
    ];

    const TRAN_TYPE_PAY    = 1;
    const TRAN_TYPE_REFUND = 2;


    public function orderRecordRel(): HasOne
    {
        return $this->hasOne(
            MybankOrderRecordModel::class,
            'orderId',
            'orderRecordId'
        );
    }

    public function orderWithholdRecordRel(): HasOne
    {
        return $this->hasOne(
            MybankOrderWithholdRecordModel::class,
            'id',
            'orderWithholdRecordId'
        );
    }


}
